package com.pie4cloud.pie.job.biz.service.execute.impl;

import com.pie4cloud.pie.common.core.util.R;
import com.pie4cloud.pie.common.core.util.RedisUtil;
import com.pie4cloud.pie.job.api.dto.CallBackDto;
import com.pie4cloud.pie.job.api.entity.JobInfoEntity;
import com.pie4cloud.pie.job.biz.config.FeignRemote;
import com.pie4cloud.pie.job.biz.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: sod
 * @描述
 * @创建人 zzj
 * @创建时间 2019/12/30 17:47
 */
@Slf4j
@Service("executeBaseService")
public abstract class ExecuteBaseService {

    protected static final String QUARTZ_HTHT_PERFORM = "QUARTZ:HTHT:PERFORM";
    protected static final String QUARTZ_HTHT_TASK_SERIAL = "QUARTZ:HTHT:SINGLE:SERIAL";
    protected static final String QUARTZ_HTHT_CLUSTER_SERIAL = "QUARTZ:HTHT:CLUSTER:SERIAL";

    @Autowired
    private RedisUtil redisUtil;

    public void executeBusiness(JobInfoEntity jobInfoEntity, R<String> resultT) {
        if(StringUtils.isEmpty(jobInfoEntity.getExecutorHandler())){
			String handler = jobInfoEntity.getType().toLowerCase() + "Handler";
			if (null == jobInfoEntity.getExecutorHandler() || !StringUtils.isNotNullString(jobInfoEntity.getExecutorHandler())) {
				jobInfoEntity.setExecutorHandler(handler);
			}
		}
        this.remote(jobInfoEntity,resultT);

    }




    public abstract void checkExecutorBlockStrategyEnum(JobInfoEntity jobInfoEntity);

    public abstract void remote(JobInfoEntity jobInfoEntity, R<String> resultT);


	public abstract void callBack(CallBackDto callBackDto);




}
